<?php
namespace app\api\controller\user;
use app\api\controller\Controller;
use app\api\model\Order as OrderModel;
use app\api\model\Activity as ActivityModel;

/**
 * 个人中心主页
 */
class Index extends Controller
{
    /**
     * 获取当前用户信息
     */
	public function detail()
    {
        // 当前用户信息
        $userInfo = $this->getUser();
		//优惠活动
		$activity = new ActivityModel;
        // 订单总数
        $model = new OrderModel;
        $orderCount = [
            'tang' => $model->getApiCount($userInfo['user_id'], '10001'),
            'bao' => $model->getApiCount($userInfo['user_id'], '2'),
			'wai' => $model->getApiCount($userInfo['user_id'], '3'),
			'activity' => $activity->getCount()
        ];
        return $this->renderSuccess(compact('userInfo', 'orderCount'));
    }
	

}
